[Github]hexo-theme-mnh

修改自 hexo-theme-polarbearsimple

看了很多主题,都没有满意的,所以选了一个比较好的底子,自己修改了

在线预览 Demo

安装

1.安装 Hexo 插件 hexo-renderer-sass hexo-renderer-swig hexo-generator-archive and hexo-algoliasearch

1
npm install hexo-renderer-scss@github:meannoharm/hexo-renderer-sass hexo-renderer-swig hexo-generator-archive hexo-algoliasearch --save

如果使用的 nodejs 版本大于 12, hexo-renderer-sass 包可能会安装错误, 可以查看 IssuePull request.

可以运行下面的命令,安装 @kmuncie 版本的 hexo-renderer-sass

1
npm install --save https://github.com/kmuncie/hexo-renderer-sass

2.将主题下载到 Hexo 主题文件夹

1
git clone https://github.com/meannoharm/hexo-theme-mnh themes/mnh

3.修改 your_site/_config.yml 文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Extensions
## Plugins: http://hexo.io/plugins/
## Themes: http://hexo.io/themes/
theme: mnh

# Show all articles at archive page.
# Need to install hexo-generator-archive
archive_generator:
per_page: 0
yearly: false
monthly: false
daily: false

# Global search based on Algolia https://www.algolia.com/
# Need to install and config hexo-algoliasearch
algolia:
applicationID: "<APP_ID>"
apiKey: "<API_KEY>"
adminApiKey: "<ADMIN_API_KEY>"
chunkSize: 5000
indexName: "<INDEX_NAME>"
fields:
- content:strip:truncate,0,500
- excerpt:strip
- permalink
- cover
- slug
- tags
- categories
- title

主题配置

修改 your_site/themes/mnh/_config.yml

配置主题组件功能

1
2
3
4
5
6
7
8
9
10
11
12
13
# widget function
# false: disable
# widget_custom: custom your widget
# title: your widget title
# content: Add your html code in here. Example: <p>testing...</p>
widget:
Tags: true
Categories: false
Custom: false

widget_custom:
title: Test
content: <p>testing...</p>

网站分析

1
2
3
4
5
6
7
8
9
# Baidu Analytics
baidu_analytics:
enable: true
key: "[BAIDU ANALYTICS KEY]"
# Google Analytics
# use google analytics 4
google_analytics:
enable: true
gtag: "[GOOGLE ANALYTICS GTAG]"

评论功能

1
2
3
4
5
6
7
8
9
10
# Duoshuo
duoshuo_shortname:
# Disqus
disqus_shortname:
# utterances
utterances:
enable: true
repo: "[ENTER REPO HERE]"
issueTerm: pathname
theme: github-light

许可证配置

1
2
3
license:
name: CC-BY-NC-SA 4.0
link: https://creativecommons.org/licenses/by-nc-sa/4.0/